<?php
require("include/top.php");

		$categories= Category::getAllCategory();
		$tpl->assign ('categories',$categories);

if(!empty($_POST['save'])){
require(FORM_PATH."push.form.php");
}


					
$tpl->display("header.tpl");
$tpl->display("menu.tpl");
if(!empty($_GET['cat'])) {
	$_SESSION['pushes']=Push::getAllPushes($_GET['cat'],0,0);
	$tpl->assign('pushes',$_SESSION['pushes']);
	
	$category=new Category($_GET['cat']);
	$category->load();
	$tpl->assign('category',$category);
}
elseif(!empty($_GET['subcat'])) {

	$subcategory=new Subcategory($_GET['subcat']);
	$subcategory->load();
	$category=new Category($subcategory['id_famille']);
	$category->load();
	$_SESSION['pushes']=Push::getAllPushes($category['id'],$_GET['subcat'],0);
	$tpl->assign('pushes',$_SESSION['pushes']);
	$tpl->assign('category',$category);
	$tpl->assign('subcategory',$subcategory);
	
}





$tpl->display("push.tpl");
$tpl->display("footer.tpl");					
					
require('include/bottom.php');	
?>